package cn.tedu._05mvcboot01.controller;

import cn.tedu._05mvcboot01.pojo.dto.BMIDto;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BMIContrller {
    @RequestMapping("/bmi")
    @ResponseBody
    public String index(BMIDto bmiDto){
        double height= bmiDto.getHeight();
        double weight= bmiDto.getWeight();
        double bmi=weight/(height*height);
        String ret="";
        if (bmi<18.5){
            ret= "偏瘦";
        }else if (bmi<24){
            ret= "正常";
        }else if (bmi<27){
            ret= "微胖";
        }else if (bmi>=27){
            ret= "该减肥了！";
        }
        return ret;
    }
}
